<!--
 * @description: 
 * @Author: vikingShip
 * @Date: 2021-11-04 14:20:04
 * @LastEditors: vikingShip
 * @LastEditTime: 2022-02-09 13:27:19
-->
<script lang="ts">
  import Vue from "vue";
  export default Vue.extend({
    mpType: 'app',
    globalData: {
      isTrans: false,
    },


    async onLaunch() {
      // try {
      this.$storage.clear();
      //   await this.verifyBaseLib();
      if (
        this.$global.compareVersion(
          uni.getSystemInfoSync().SDKVersion || "",
          process.env.VUE_APP_BASE_LIB_VERSION || "",
        ) < 0
      ) {
        this.$Popup.alert("温馨提示", "当前基础库版本较低，为了更好的体验，请先升级微信");
      }

      await this.$store.dispatch('userStore/getTenId');
      // await this.$store.dispatch('userStore/login');
      await this.$store.dispatch('userStore/getCode');

      await this.$store.dispatch('shopset/getshopset');
      await this.$store.dispatch('settingStore/getRule');
      await this.$store.dispatch('settingStore/getDecorationAllList');
      await this.$store.dispatch('settingStore/getGuideList');


      await this.$store.dispatch('settingStore/getGuideVisible');

      // 获取店铺设置
      //   this.getSetting();

      const res = await this.$store.dispatch('settingStore/getSetting');

      this.$store.commit('message/getTemplates', res);
      await this.$store.dispatch('settingStore/getRecyclingSetting');
      this.$store.dispatch('settingStore/getAllUserCenterData');
      this.$store.commit('settingStore/setIsReady');

      // TODO 骨架屏闪动暂时解决方案
      // (global as any).loadedObj = {};

      // 需要拿到用户数据再执行请求的监听此事件
      this.$Pubsub.emit("app-launch");
      // } catch (err) {

      //   this.$Popup.alert("温馨提示",err).then(() => {
      //     uni.clearStorageSync();
      //     uni.reLaunch({
      //       url: "/pages/index/index"
      //     });
      //   });
      // }
    }
  })
</script>

<style lang="scss">
  // uview基础样式
 
  /*每个页面公共css */
  @import "@/assets/styles/font/iconfont.scss";
  @import "@/assets/styles/common.scss";

</style>